package cn.com.duiba.millionaire.center.biz.dao.impl;

import cn.com.duiba.millionaire.center.biz.constants.DatabaseSchema;
import cn.com.duiba.millionaire.center.biz.dao.BaseDao;
import cn.com.duiba.millionaire.center.biz.dao.MillionaireShareCodeUserRelationDao;
import cn.com.duiba.millionaire.center.biz.entity.MillionaireShareCodeUserRelationEntity;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * Created by sty on 1/20/18.
 */
@Repository
public class MillionaireShareCodeUserRelationDaoImpl extends BaseDao implements MillionaireShareCodeUserRelationDao {
    @Override
    public MillionaireShareCodeUserRelationEntity insert(MillionaireShareCodeUserRelationEntity millionaireShareCodeUserRelationEntity) {
        insert("insert", millionaireShareCodeUserRelationEntity);
        return millionaireShareCodeUserRelationEntity;
    }


    @Override
    public MillionaireShareCodeUserRelationEntity findByShareCode(String shareCode, Long appId) {
        Map<String, Object> params = Maps.newHashMap();
        params.put("shareCode", shareCode);
        params.put("appId", appId);
        return selectOne("selectByShareCode",params);
    }

    @Override
    protected DatabaseSchema chooseSchema() {
        return DatabaseSchema.MILLIONAIRE_CONFIG;
    }
}
